package com.tzpay.tzpay.presenter;

import android.os.Message;

import com.tzpay.tzpay.common.BaseHandler;

/**
 * Created by chenfeiyue on 16/3/14.
 */
public class MyHandler extends BaseHandler<BaseLogicView> {

    public static final int MESSAGE_SUCCESS = 100;
    public static final int MESSAGE_FAILED = MESSAGE_SUCCESS + 1;

    public MyHandler(BaseLogicView view) {
        super(view);
    }

    @Override
    public void onHandleMessage(Message msg, BaseLogicView view) {
        switch (msg.what) {
            case MESSAGE_FAILED:
                String errorMsg = "";
                if (msg.obj != null) {
                    errorMsg = (String) msg.obj;
                }
                view.onFailed(errorMsg);
                break;
            case MESSAGE_SUCCESS:
                view.onSuccess(msg.obj);
                break;
        }
    }
}
